package com.css.mapper;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.css.entity.DataAirPort;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author Dbj
 * @date 2024年11月07日  20:36
 */
@DS("slave")
@Mapper
public interface DataAirPortMapper  extends BaseMapper<DataAirPort> {

    @Select("select  ceiling(st_distance(t1.geom, st_geomfromtext(#{geomText},4490))*111195/1000) distance,t1.name from (select t.* from data_airport t where ST_Intersects(geom, st_geomfromtext(#{geom},4490))) t1 order by distance limit #{num}")
    List<DataAirPort> getData(@Param("geom") String geom,@Param("geomText") String geomText,@Param("num") int num);
}
